<template>
  <el-dialog
    title="更换SN码"
    :visible.sync="showFlag"
    :modal="false"
    width="40%"
  >
    <div class="app-container" style="padding-top: 0px">
      <div class="contentDiv">
        <el-form
          ref="form"
          class="perForm"
          :model="caseInfo"
          label-width="120px"
          size="medium"
          :inline="true"
          style="margin-top: 20px"
        >
          <el-form-item label="旧SN码" prop="reportSn">
            <el-input v-model="caseInfo.reportSn" />
          </el-form-item>

          <el-form-item label="新SN码" prop="snCode">
            <el-input v-model="caseInfo.snCode" />
          </el-form-item>
        </el-form>
        
      </div>
    </div>
    <div slot="footer" class="dialog-footer" >
        <el-button type="primary" @click="confirmSelect" >确 定</el-button>
    </div>
    </el-dialog>
</template>
      
  <script>
// reportAll
import { replaceSn } from "@/api/mes/pro/workorderSn";
export default {
  name: "productReport",
  data() {
    return {
      caseInfo: {},
      showFlag:false,
    };
  },
  methods: {
    init(row){
        console.log(row,'row');
        this.caseInfo.reportSn = row.snCode
        this.caseInfo.snId = row.snId
        this.showFlag= true
    },
    // getList() {
    //   reportAll({ caseId: this.reportSn }).then((res) => {
    //     console.log(res, "=====res=====");
    //     this.caseInfo = res.data.caseInfo || {};
    //   });
    // },
    //确定
    confirmSelect(){
        this.showFlag = false
        let param={
            snCode:this.caseInfo.snCode,
            snId :this.caseInfo.snId
        }
        replaceSn(param).then(res=>{
            if(res.code == 200){
                this.$message.success(res.msg)
                this.$parent.getList();
            }
        })
    },
  },
};
</script>
      <style lang="scss" scoped>
// .contentDiv {
//   width: 1350px;
// }
.el-table {
  margin-bottom: 15px;
}
</style>